<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <title></title>

    <meta name=viewport
        content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui">
    <meta name="referrer" content="no-referrer">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta name="description" content="高速在线观看，无需下载播放器。">
    <meta name="keywords" content="电影">
    <meta name="generator" content="CMS">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
    <link th:href="@{/video/skin/skin.css}" rel="stylesheet" />
    <link th:href="@{/video/detail/all-responsive-metal.css}" rel="stylesheet" type="text/css" />
    <link th:href="@{/video/detail/jquery.fancybox-metal.css}" rel="stylesheet" type="text/css" />
    <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>

    <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>

</head>

<div class="top-links">
    <div class="center-hold">
        <div class="network">
            <strong></strong>
            <ul>
            </ul>
        </div>
        <div class="box tags-cloud">
            <a class="highlight" th:each="item:${categoryList}" style="font-weight: bold; font-size: 13px;"
                th:href="@{'/video/category?categoryId='+${item.categoryId}}">[[${item.categoryName}]] &nbsp;&nbsp;
            </a>
        </div>
        <div class="member-links">
            <ul>
                <li><a href="/video">首页</a></li>
                <ul th:if="${authMpEnabled==true}">
                    <li th:if="${user?.id}"><a href="/logout">注销</a></li>
                    <li th:unless="${user?.id}"><a href="/login">登录</a></li>
                </ul>
            </ul>
        </div>
    </div>
</div>
<div class="container">
    <div class="header">

    </div>
    <div class="content">
        <div class="headline">
            <h1>[[${shipin.name}]]</h1>
        </div>
        <div class="block-video">
            <div class="table">

                <style>
                    ul,
                    li {
                        list-style: none;
                    }


                    i {
                        font-style: normal;
                    }

                    .right-vip .bac .arrow i {
                        border-color: #000 !important;
                        border-right-color: #f5a623 !important;
                    }

                    .right-vip .right-vip-left-top i {
                        font-size: 14px;
                    }

                    .right-vip .right-vip-left-top .arrow i {
                        border: 6px solid #424242;
                        display: block;
                        position: absolute;
                        top: 8px;
                        left: -12px;
                        border-right-color: #f5a623;
                    }

                    .right-vip .right-vip-left-bottom p {
                        font-size: 12px;
                    }

                    .right-vip .right-vip-left-bottom p:nth-child(1) {
                        color: #BDBDBD;
                    }

                    .right-vip .right-vip-left-bottom p:nth-child(2) {
                        color: #F5A623;
                        padding: 5px 0;
                    }

                    .right-vip .right-vip-right a {
                        top: 50%;
                        margin-top: -20px;
                        text-decoration: none;
                        position: absolute;
                        width: 60px;
                        height: 30px;
                        line-height: 30px;
                        border-radius: 25px;
                        background-color: #F32B70;
                        text-align: center;
                        display: block;
                        color: #fff;
                    }

                    .right-vip .right-vip-text p {
                        color: #BDBDBD;
                        font-size: 12px;
                        line-height: 1.5;
                    }

                    .right-vip .text-Bot .right-vip-left-bottom p span {
                        color: #F5A623
                    }

                    .right-vip .right-vip-block.mar .mar-text-p p {
                        color: #BDBDBD;
                        font-size: 13px;
                        letter-spacing: 1px;
                        line-height: 170%;
                    }

                    .right-vip .right-vip-block.mar .CustomerService i {
                        color: red;
                    }

                    .right-vip .text-Bot .right-vip-right a {
                        border: 1px solid;
                        border-radius: 50px;
                        width: 110px;
                        height: 33px;
                        line-height: 33px;
                        text-align: center;
                        color: #F5A623;
                        float: left;
                        background: none !important;
                    }

                    @media screen and (min-width: 860px) {}
                </style>
            </div>

            <input type="hidden" th:value="${shipin.videoUrl}" id="src" />
            <input type="hidden" th:value="${shipin.url}" id="poster" />
            <input type="hidden" th:value="${shipin.id}" id="id" />
            <input type="hidden" th:value="${wxPayUrl}" id="wxPayUrl" />

            <script type="text/javascript">
                window.addEventListener('resize', function () {
                    document.getElementById('mse').style.height = window.innerHeight + 'px';
                });

            </script>
            <div id="mse"></div>
            <script src="//cdn.jsdelivr.net/npm/xgplayer/browser/index.js" charset="utf-8"></script>
            <script src="//cdn.jsdelivr.net/npm/xgplayer-mp4/browser/index.js" charset="utf-8"></script>
            <script type="text/javascript">
                let player = new Player({
                    "id": 'mse',
                    autoplay: false,
                    "url": document.getElementById('src').value,
                    "volume": 0.3,
                    "fluid": true,
                    "preloadTime": 15, // 默认预加载 15 秒
                    "poster": document.getElementById('poster').value,
                    "playsinline": true,
                    "closeVideoTouch": true,
                    "closeVideoDblclick": true,
                    "closeVideoClick": true,
                    "whitelist": [''],
                    lang: 'zh-cn',
                    "videoInit": true,
                    keyShortcut: 'on',
                    cssFullscreen: false,
                    'x5-video-player-fullscreen': false,
                    "x5-video-player-type": "h5",
                    "x5-video-orientation": "portraint",
                    customConfig: {
                        //
                    },
                    execBeforePluginsCall: [() => {
                        console.log('Execute before plugins call')
                    }]

                });

                player.on('play', function () {
                    $.ajax({
                        type: "post",
                        url: "/video/queryOrder",
                        data: {
                            "id": $("#id").val(),
                            "redirect_uri": window.location.href
                        },
                        error: function (jqXHR, textStatus, errorThrown) {
                            /*错误信息处理*/
                            player.pause();
                            console.log(errorThrown);

                        },
                        success: function (r) {
                            console.log(r);
                            if (r.code === 0) {
                                var rep = r.data;
                                if (rep.status === 0 || rep.status === 2) {
                                    player.pause();
                                    const text = "<font color='#4F4F4F'> 打赏" + rep.moneyStr + "元,永久免费观看此视频 </font>";
                                    //如果参数过多，建议通过 object 方式传入
                                    $.confirm({
                                        title: '标题',
                                        text: text,
                                        onOK: function () {
                                            let value = document.getElementById('wxPayUrl').value;
                                            let flag = value.indexOf("?") !== -1;
                                            const callbackUrl = window.location.href;
                                            if (flag) {
                                                window.location.href = value + "&orderId=" + rep.orderId + "&callbackUrl=" + encodeURIComponent(callbackUrl);
                                            } else {
                                                window.location.href = value + "?orderId=" + rep.orderId + "&callbackUrl=" + encodeURIComponent(callbackUrl);
                                            }
                                        },
                                        onCancel: function () {

                                        }
                                    });
                                } else if (rep.status === 1) {
                                    player.play();
                                }
                            } else if (r.code === 500) {
                                player.pause();
                                const text = "<font color='#4F4F4F'> " + r.msg + "</font>";
                                const redirect_uri = r.redirect_uri;
                                //如果参数过多，建议通过 object 方式传入
                                $.confirm({
                                    title: '标题',
                                    text: text,
                                    onOK: function () {
                                        window.location.href = "/login.html?redirect_uri=" + redirect_uri;
                                    },
                                    onCancel: function () {

                                    }
                                });

                            } else {
                                player.pause();
                            }
                        }
                    });
                });

                $(function () {
                    $('#toggle-button').click(function (e) {
                        let obj = $(this);
                        obj.prop('href', '/video/tswq?type=');

                    });
                });

            </script>


            <div class="video-holder">
                <div class="player">
                </div>
                <div class="video-info">
                    <div class="info-holder">
                        <div class="info-buttons">
                            <div class="tabs-menu">
                                <ul>
                                    <li>
                                        <a href="javascript:" id="toggle-button" class="toggle-button">投诉</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div id="tab_video_info" class="tab-content">
                            <div class="block-details">
                                <div class="info">
                                    <div class="item">
                                        <span>时长: <em>[[${shipin.shijianStr}]]</em></span>
                                        <span>浏览: <em> [[${shipin.click}]]</em></span>
                                    </div>
                                    <div class="item">
                                        类别:
                                        <a href="">[[${category.categoryName}]]</a>
                                    </div>

                                </div>
                            </div>
                        </div>

                        <div id="tab_share" class="tab-content hidden">
                            <div class="block-share">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="related-videos" id="list_videos_related_videos">
            <ul class="list-sort" id="list_videos_related_videos_filter_list">
                <li><span>相关视频</span></li>
            </ul>

            <div class="box">
                <div class="list-videos">
                    <div class="margin-fix" id="list_videos_related_videos_items">
                        <div class="item  " th:each="role:${list}">
                            <a th:href="@{'/video/detail?id='+${role.id}+'&author='+${role.userId}}"
                                th:title="${role.name}">
                                <div class="img">
                                    <img class="thumb lazy-load" th:src="${role.url}" th:data-original="${role.url}"
                                        th:alt="${role.name}" data-cnt="5" width="180" height="135">

                                </div>
                                <strong class="title">
                                    [[${role.name}]]
                                </strong>
                                <div class="wrap">
                                    <div class="duration">[[${role.shijianStr}]]</div>
                                </div>
                                <div class="wrap">
                                    <div class="added"><em>[[${role.diffDays}]]</em></div>
                                    <div class="views">[[${role.click}]]</div>
                                </div>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="footer-margin">
        <div class="content">
            <div class="box bottom-adv">
            </div>
        </div>
    </div>
</div>

<div class="footer">
    <div class="footer-wrap">
        <ul class="nav">
            <li><a href="/video">主页</a></li>
        </ul>
        <div class="copyright">
            2012-2020 <a href="/video"></a><br>
        </div>
    </div>
</div>
<script>
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
</script>
</body>

</html>